//
//  IGPictureListDetailVC.m
//  jingdongfang
//
//  Created by RKL on 2018/5/7.
//  Copyright © 2018年 BOE-SBG-CTO. All rights reserved.
//

#import "IGPictureListDetailVC.h"
#import "HeaderView.h"
#import "WSLWaterFlowLayout.h"
#import "PicRectionViewCollectionViewCell.h"
#import "IGPicListMainCollectionViewCell.h"
#import "CollectionReusableViewTitle1.h"
#import "CollectionReusableViewTitle2.h"
#import "IGPictureListSortVC.h"
#import "IGPictureDetailApi.h"
#import "IGPictureDetailAddFavoritApi.h"
#import "IGPictureDetailCancelFavoritApi.h"
#import "IGPictureDetailRelatedRecApi.h"
#import "IntroduceArtsVC.h"
#import "ArtOperationView.h"
#import "IGArtWorkModel.h"
#import "IGCommentVC.h"
#import "YXScrollowActionSheet.h"
#import "XiangQingViewController.h"
#import "IGMoreWorksSelectVC.h"
#import "IGEditPictureListVC.h"
#import "IGSheetView.h"

@interface IGPictureListDetailVC ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,WSLWaterFlowLayoutDelegate,HeaderViewDelegate,CollectionReusableViewTitle1Delegate,PicRectionViewCollectionViewCellDelegate,IGPicListMainCollectionViewCellDelegate>
{
    UILabel* titlelable;
    UIBarButtonItem *backButton;
}
@property (nonatomic, strong) UICollectionView *mainCollectionView;
@property (nonatomic, strong) HeaderView *headerView;
@property (nonatomic, strong) UIButton * right;

@property (nonatomic, strong) IGPictureDetailApi * pictureDetailApi;
@property (nonatomic, strong) IGDrawModel * detailMode;
@property (nonatomic, strong) IGPictureDetailAddFavoritApi * addFavoritApi;
@property (nonatomic, strong) IGPictureDetailCancelFavoritApi * cancelFavoritApi;
@property (nonatomic, strong) IGPictureDetailRelatedRecApi * relatedRecApi;


/**
 数据源
 */
@property (nonatomic, strong) NSMutableArray * dataArr;

/**
 相关画单推荐的数据源
 */
@property (nonatomic, strong) NSMutableArray * relatedRecDataArr;

/**
 喜欢的临时数据
 */
@property (nonatomic, copy) NSString * tempLoveNum;
@end

static NSString * const PicRectionViewCollectionViewCellID = @"PicRectionViewCollectionViewCellID";
static NSString * const IGPicListMainCollectionViewCellID = @"IGPicListMainCollectionViewCellID";

static NSString * const reusableViewTitle2ID = @"reusableViewTitle2ID";
static NSString * const reusableViewTitle1ID = @"reusableViewTitle1ID";
static NSString * const reusableViewHeaderID = @"reusableViewHeaderID";

@implementation IGPictureListDetailVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.mainCollectionView];
    
    UIImage *backButtonImage  = [UIImage imageNamed:@"wallet-back"];
    backButtonImage = [backButtonImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    backButton = [[UIBarButtonItem alloc] initWithImage:backButtonImage style:UIBarButtonItemStylePlain target:self action:@selector(didTapBackButton)];
    self.navigationItem.leftBarButtonItem = backButton;
    
    titlelable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, GSCALE(100) , GSCALE(44))];
    titlelable.font = [UIFont boldSystemFontOfSize:20];
    titlelable.textColor = [UIColor whiteColor];
    titlelable.textAlignment = NSTextAlignmentCenter;
    titlelable.text = @"画单详情";
    self.navigationItem.titleView = titlelable;
    
    self.right = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.right setTitle:@"编辑" forState:UIControlStateNormal];
    [self.right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.right addTarget:self action:@selector(rightClick:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.right];

    
    [self setTableViewHeaderView];
    [self setPrivateNavigationBar];
    
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self setPrivateNavigationBar];
    [self scrollViewDidScroll:self.mainCollectionView];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];

    [self privateGetDateRequest];
    [self privateGetrelatedRecDateRequest];

}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];

    [self.navigationController.navigationBar setBackgroundImage:[self createImageWithColor:[UIColor colorWithRed:254.0/255.0 green:254.0/255.0 blue:254.0/255.0 alpha:1.0]] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:254.0/255.0 green:254.0/255.0 blue:254.0/255.0 alpha:1.0];
}
#pragma mark - 返回按钮
- (void)didTapBackButton
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (UIImage *)createImageWithColor:(UIColor *)color
{
    
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}

- (void)setTableViewHeaderView
{
    __weak typeof(self) weakSelf = self;
    self.headerView = [[HeaderView alloc]initWithFrame:CGRectMake(0, 0, KSCREENWIDTH, kTabViewHeight)];
    self.headerView.delegate = self;
    [self.headerView setIconPicStr:self.detailMode.image withCompleteBlock:^{
        [weakSelf scrollViewDidScroll:weakSelf.mainCollectionView]; //回调后刷新navigationBar
    }];
}
- (void)setPrivateNavigationBar
{
    UINavigationBar * bar = self.navigationController.navigationBar;
    //首次透明
    [bar setTranslucent: true];;
    [bar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    [bar setShadowImage:[[UIImage alloc] init]];
    
    //设置起始坐标为0
    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }

}

#pragma mark - 右上角编辑按钮
- (void)rightClick:(UIBarButtonItem *)sender
{
    [IGSheetView ig_actionSheetWithActionTitles:@[@"编辑画单信息",@"排序"] actionHander:^(NSUInteger index)
    {
        if (index == 0)
        {
            IGEditPictureListVC * vc = [[IGEditPictureListVC alloc] init];
            vc.drawModel = self.detailMode;
            vc.drawListId = self.drawlistId;
            [self.navigationController pushViewController:vc animated:YES];
        }
        else
        {
            IGPictureListSortVC * vc = [[IGPictureListSortVC alloc] init];
            vc.drawlistId = self.drawlistId;
            [self.navigationController pushViewController:vc animated:YES];
        }
    }];
}

#pragma mark - 请求的数据
- (void)privateGetDateRequest
{
    __weak typeof(self) weakSelf = self;
    [self.pictureDetailApi startWithDecodeClass:[IGPictureDetailResp class]
                     CompletionBlockWithSuccess:^(id responseObject, NSError *error)
    {
        if (responseObject)
        {
            IGPictureDetailResp * resp = responseObject;
            self.detailMode = resp.data;
            weakSelf.dataArr = [NSMutableArray arrayWithArray:self.detailMode.productList];
            
            [weakSelf.mainCollectionView reloadData];
            [weakSelf privateRefrshUI];
        }
    }];
        
}

- (void)privateGetrelatedRecDateRequest
{
    __weak typeof(self) weakSelf = self;
    [self.relatedRecApi startWithDecodeClass:[IGPictureDetailRelatedRecResp class]
                     CompletionBlockWithSuccess:^(id responseObject, NSError *error)
     {
         if (responseObject)
         {
             IGPictureDetailRelatedRecResp * resp = responseObject;
             
             weakSelf.relatedRecDataArr = [NSMutableArray arrayWithArray:resp.data.drawlist];
             
             [weakSelf.mainCollectionView reloadData];
         }
     }];
}

#pragma mark - 刷新头部的UI
- (void)privateRefrshUI
{
    __weak typeof(self) weakSelf = self;
    [self.headerView setIconPicStr:self.detailMode.image withCompleteBlock:^{
        [weakSelf scrollViewDidScroll:weakSelf.mainCollectionView]; //回调后刷新navigationBar
    }];
    
    self.headerView.titleLabel.text = self.detailMode.title;
    [self.headerView.authorImageView sd_setImageWithURL:[NSURL URLWithString:self.detailMode.userImage]];
    self.headerView.authorLabel.text = self.detailMode.userName;
    
    self.headerView.btnLabel1.text = self.detailMode.loveNum;
    self.headerView.btnLabel2.text = self.detailMode.commentNum;
    self.headerView.btnLabel3.text = self.detailMode.shareNum;

    if ([self.detailMode.ifEdit isEqualToString:@"1"])//有编辑按钮
    {
        self.right.hidden = NO;
        if ([self.detailMode.secrecy isEqualToString:@"1"])//是公开作品
        {
            self.headerView.btn1.userInteractionEnabled = NO;
            self.headerView.btn2.userInteractionEnabled = YES;
            self.headerView.btn3.userInteractionEnabled = YES;
        }
        else//是私密作品
        {
            self.headerView.btn1.userInteractionEnabled = NO;
            self.headerView.btn2.userInteractionEnabled = NO;
            self.headerView.btn3.userInteractionEnabled = NO;
        }
    }
    else//无编辑按钮
    {
        self.right.hidden = YES;
        self.headerView.btn1.userInteractionEnabled = YES;
        self.headerView.btn2.userInteractionEnabled = YES;
        self.headerView.btn3.userInteractionEnabled = YES;
    }

    if ([self.detailMode.ifLove integerValue] == 1)
    {
        self.headerView.isLike = YES;
        self.headerView.btn1.selected = YES;
    }
    else
    {
        self.headerView.isLike = NO;
        self.headerView.btn1.selected = NO;
    }
    self.headerView.lookStr = self.detailMode.browseNum;
    self.tempLoveNum = self.detailMode.loveNum;//临时的数据
}


#pragma mark collectionView代理方法
//返回section个数
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 3;
}

//每个section的item个数
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    if (section == 1)
    {
        return self.dataArr.count;
    }
    else if (section == 2)
    {
        return 1;
    }
    return 0;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell;
    
    if (indexPath.section == 2)
    {
        cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:PicRectionViewCollectionViewCellID forIndexPath:indexPath];
        ((PicRectionViewCollectionViewCell *)cell).delegate = self;
        ((PicRectionViewCollectionViewCell *)cell).dataSourse = self.relatedRecDataArr;

    }
    else if(indexPath.section == 1)
    {
        cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:IGPicListMainCollectionViewCellID forIndexPath:indexPath];
        IGArtWorkModel *base = _dataArr[indexPath.item];
        ((IGPicListMainCollectionViewCell *)cell).dataModel = base;
        ((IGPicListMainCollectionViewCell *)cell).delegate = self;
//        cell.backgroundColor = [UIColor purpleColor];
    }
    return cell;
}

- (CGFloat)waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout heightForItemAtIndexPath:(NSIndexPath *)indexPath itemWidth:(CGFloat)itemWidth
{
    if (indexPath.section == 1)
    {
        IGArtWorkModel *base = _dataArr[indexPath.item];
        if ([base.plates integerValue]==1)
        {
            //横板
            return ((KSCREENWIDTH-16)/2*1080/1920);
        }
        else if ([base.plates integerValue]==2)
        {
            //坚板
            return ((KSCREENWIDTH-16)/2*1920/1080);
        }
    }
    if (indexPath.section == 2)
    {
        return 163;
    }
    return 0;
//    return ((KSCREENWIDTH-16)/2*1080/1920);
}
/** 头视图Size */
-(CGSize )waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForHeaderViewInSection:(NSInteger)section
{
    if (section == 0)
    {
        return CGSizeMake(self.view.frame.size.width, kTabViewHeight);
    }
    else
    {
        return CGSizeMake(self.view.frame.size.width, 50);
    }
}
/** 脚视图Size */
-(CGSize )waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout sizeForFooterViewInSection:(NSInteger)section
{
    return CGSizeZero;
}
- (UIEdgeInsets)edgeInsetInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout
{
    return  UIEdgeInsetsZero;
}

//设置每个item水平间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    if (section == 0)
    {
        return CGFLOAT_MIN;
    }
    else
    {
        return 0;
    }
    
}
//设置每个item垂直间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    if (section == 0)
    {
        return CGFLOAT_MIN;
    }
    else
    {
        return 2;
    }
    
}

//通过设置SupplementaryViewOfKind 来设置头部或者底部的view，其中 ReuseIdentifier 的值必须和 注册是填写的一致，本例都为 “reusableView”
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.section == 0)
    {
        UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewHeaderID forIndexPath:indexPath];
        [headerView addSubview:self.headerView];
        return headerView;
    }
    else if (indexPath.section == 1)
    {
        CollectionReusableViewTitle1 *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewTitle1ID forIndexPath:indexPath];
        headerView.totolNum.text = [NSString stringWithFormat:@"(%lu)",(unsigned long)self.detailMode.productList.count];
        headerView.delegate = self;
        return headerView;
    }
    else
    {
        CollectionReusableViewTitle2 *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewTitle2ID forIndexPath:indexPath];
        headerView.titleLabel.text = @"相关画单推荐";
        return headerView;
    }
}

//点击item方法
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"%s",__func__);
    if (indexPath.section == 1)
    {
//        对应画作的id
//        [self.dataArr[indexPath.item] objectForKey:@"id"];
        NSLog(@"%@-------%ld",[self.dataArr[indexPath.item] objectForKey:@"id"],(long)indexPath.item);
        XiangQingViewController * vc = [[XiangQingViewController alloc] init];
        vc.p_id = [self.dataArr[indexPath.item] objectForKey:@"id"];
        vc.isRoot = NO;
        [self.navigationController pushViewController:vc animated:YES];
    }
}



- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    CGFloat y = self.mainCollectionView.contentOffset.y;
    NSLog(@"%f",y);
    
    if (y < - KHeadViewOff)
    {
        [self.mainCollectionView setContentOffset:CGPointMake(0, - KHeadViewOff + 1) animated:0];
    }
    
    if ( y < kTabViewHeight)
    {
        //截图背景图的部分截图 用于设置navigatonBar背景图，造成连贯视觉落差
        UIImage * view = [self getImageFromView:self.headerView.backgroundImageView withContentOffY: -(self.mainCollectionView.contentOffset.y) - KHeadViewOff];
        [self.navigationController.navigationBar setBackgroundImage:view forBarMetrics:UIBarMetricsDefault];
    }
    else
    {
        UIImage * view = [self getImageFromView:self.headerView.backgroundImageView withContentOffY:-kTabViewHeight -kNavBarHeight];
        [self.navigationController.navigationBar setBackgroundImage:view forBarMetrics:UIBarMetricsDefault];
    }
}
#pragma mark - 懒加载
- (UICollectionView *)mainCollectionView
{
    if (_mainCollectionView == nil)
    {
        //1.初始化layout
        WSLWaterFlowLayout * layout = [[WSLWaterFlowLayout alloc] init];
        layout.delegate = self;
        layout.flowLayoutStyle = WSLVerticalWaterFlow;
        //2.初始化collectionView
        _mainCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kNavBarHeight) collectionViewLayout:layout];
        [self.view addSubview:_mainCollectionView];
        if (@available(iOS 11.0, *))
        {
            _mainCollectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
            _mainCollectionView.scrollIndicatorInsets = _mainCollectionView.contentInset;
        }
        _mainCollectionView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
        _mainCollectionView.backgroundColor = [UIColor whiteColor];
        _mainCollectionView.clipsToBounds = NO;
        //3.注册collectionViewCell
        //注意，此处的ReuseIdentifier 必须和 cellForItemAtIndexPath 方法中 一致 均为 cellId
        [_mainCollectionView registerClass:[PicRectionViewCollectionViewCell class] forCellWithReuseIdentifier:PicRectionViewCollectionViewCellID];
        
        [_mainCollectionView registerClass:[IGPicListMainCollectionViewCell class] forCellWithReuseIdentifier:IGPicListMainCollectionViewCellID];

        //注册headerView  此处的ReuseIdentifier 必须和 cellForItemAtIndexPath 方法中 一致  均为reusableView
        [_mainCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewHeaderID];
        [_mainCollectionView registerClass:[CollectionReusableViewTitle1 class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewTitle1ID];
        [_mainCollectionView registerClass:[CollectionReusableViewTitle2 class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:reusableViewTitle2ID];
        //4.设置代理
        _mainCollectionView.delegate = self;
        _mainCollectionView.dataSource = self;
    }
    return _mainCollectionView;
}

- (IGPictureDetailRelatedRecApi *)relatedRecApi
{
    if (_relatedRecApi == nil)
    {
        _relatedRecApi = [IGPictureDetailRelatedRecApi new];
        _relatedRecApi.lid = self.drawlistId;
    }
    return _relatedRecApi;
}

- (IGPictureDetailCancelFavoritApi *)cancelFavoritApi
{
    if (_cancelFavoritApi == nil)
    {
        _cancelFavoritApi = [IGPictureDetailCancelFavoritApi new];
        _cancelFavoritApi.thingId = self.drawlistId;
    }
    return _cancelFavoritApi;
}

- (IGPictureDetailAddFavoritApi *)addFavoritApi
{
    if (_addFavoritApi == nil)
    {
        _addFavoritApi = [IGPictureDetailAddFavoritApi new];
        _addFavoritApi.thingId = self.drawlistId;
    }
    return _addFavoritApi;
}

- (IGPictureDetailApi *)pictureDetailApi
{
    if (_pictureDetailApi == nil)
    {
        _pictureDetailApi = [IGPictureDetailApi new];
        _pictureDetailApi.drawlistId = self.drawlistId;

    }
    return _pictureDetailApi;
}

- (void)dealloc {
    NSLog(@"%s",__func__);
}

/**
 截取图片
 
 @param orgView 哪个view
 @param y 起始点
 @return 截取好的image
 */
-(UIImage *)getImageFromView:(UIImageView *)orgView withContentOffY:(CGFloat)y{
    
    UIGraphicsBeginImageContext(orgView.bounds.size);
    [orgView.image drawInRect:CGRectMake(0,y, orgView.bounds.size.width, orgView.bounds.size.height)];
    UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

#pragma mark - headerView的代理方法（点击头像跳转页面）
- (void) clickLeftView
{
    NSLog(@"headerView的代理方法（点击头像跳转页面）");
    IntroduceArtsVC * vc = [[IntroduceArtsVC alloc] init];
    vc.drawId = self.drawlistId;
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - headerView的代理方法（点击作者名字跳转页面）
- (void) clickAuthorButtonClick
{
    NSLog(@"headerView的代理方法（点击作者名字跳转页面）");

}

#pragma mark - CollectionReusableViewTitle1Delegate（全部上传）
- (void)clickAllPull
{
    NSLog(@"全部上传");
    
}
#pragma mark - CollectionReusableViewTitle1Delegate（多选按钮）
- (void)clickSelectMore
{
    IGMoreWorksSelectVC *vc=[[IGMoreWorksSelectVC alloc]initWithType:artDrawType];
    vc.drawId=self.drawlistId;
    [UIViewController ig_pushViewController:vc animated:YES];
    
    NSLog(@"多选按钮");
    
}
#pragma mark - 添加喜爱代理方法
- (void)addFavoriteClick
{
    NSLog(@"添加喜爱代理方法");
    
    __weak typeof(self) weakSelf = self;
    [self.addFavoritApi startWithDecodeClass:[IGPictureDetailAddFavoritResp class]
                  CompletionBlockWithSuccess:^(id responseObject, NSError *error)
     {
         if (responseObject)
         {
             IGPictureDetailAddFavoritResp * resp = responseObject;
             if ([resp.resHeader.code isEqualToString:@"success"])
             {
                 self.tempLoveNum = [NSString stringWithFormat:@"%d",[self.tempLoveNum intValue]+1];
                 
                  weakSelf.headerView.btnLabel1.text = self.tempLoveNum;
             }
             else
             {
                 weakSelf.headerView.isLike = NO;
             }
         }
     }];
}
#pragma mark - 取消喜爱代理方法
- (void)cancleFavoriteClick
{
    NSLog(@"取消喜爱代理方法");
    __weak typeof(self) weakSelf = self;
    [self.cancelFavoritApi startWithDecodeClass:[IGPictureDetailCancelFavoritResp class]
                     CompletionBlockWithSuccess:^(id responseObject, NSError *error)
     {
         if (responseObject)
         {

             IGPictureDetailCancelFavoritResp * resp = responseObject;
             if ([resp.resHeader.code isEqualToString:@"success"])
             {
                 self.tempLoveNum = [NSString stringWithFormat:@"%d",[self.tempLoveNum intValue]-1];

                 weakSelf.headerView.btnLabel1.text = self.tempLoveNum;
             }
             else
             {
                 weakSelf.headerView.isLike = YES;
             }
         }
     }];
}
#pragma mark - 点击评论的点击事件
- (void) pinglunClick
{
    NSLog(@"点击评论的点击事件");
    IGCommentVC * commentVC = [[IGCommentVC alloc] initWithType:IGCommentPageTypeHuaDan baseModel:self.detailMode];
    [self.navigationController pushViewController:commentVC animated:YES];
}
#pragma mark - 点击分享的点击事件
- (void) shareClick
{
    YXScrollowActionSheet *cusSheet = [[YXScrollowActionSheet alloc] init];
    IGShareModel *shareModel = [_detailMode getShareModel];
    cusSheet.shareModel = shareModel;
    [cusSheet show];
}
#pragma mark - 点击推送的点击事件
- (void) pushClick
{
    NSLog(@"点击推送的点击事件");
}

#pragma mark - 点击右下角点点点的点击事件
- (void)clickMore:(IGArtWorkModel *)dataModel {
    [ArtOperationView showArtOperationViewArtWork:dataModel];
}

#pragma mark - 点击推荐画单的点击事件（跳转到相对应的画单详情页面）
- (void)clickList:(NSString *)drawListId
{
    IGPictureListDetailVC *VC = [[IGPictureListDetailVC alloc] init];
    VC.drawlistId = drawListId;
    [UIViewController ig_pushViewController:VC animated:YES];

}

@end














